<?php
namespace app\decorate\controller;
use app\AdminRest;
use app\decorate\model\Config;
use think\App;
use think\Request;


class AdminSetting extends AdminRest{
    public function __construct(App $app) {
        parent::__construct($app);
    }

    /**
     * User: chenniang
     * Date: 2019-10-14 14:38
     * @return \think\Response
     * descption:编辑插件配置
     */
    public function pulgSettingUpdate(){
        $input = $this->_input;
        foreach ($input as $key => $value){
            $res = lbPulgSettingUpdate($this->_uniacid,'decorate',$key,$value);
        }
        return $this->success($res);
    }

    /**
     * User: chenniang
     * Date: 2019-10-14 14:33
     * @return \think\Response
     * descption:获取配置信息
     */
    public function pulgSettingInfo(){
        $input = $this->_input;
        $key   = !empty($input['key'])?$input['key']:[];
        $data  = lbPulgSettingInfo($this->_uniacid,'decorate',$key);
        return $this->success($data);
    }


    /**
     * @author chenniang
     * @DataTime: 2021-01-06 18:03
     * @功能说明:配置详情
     */
    public function configInfo(){

        $config_model = new Config();

        $dis = [

            'uniacid' => $this->_uniacid
        ];

        $data = $config_model->dataInfo($dis);

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2021-01-06 18:04
     * @功能说明:
     */
    public function configUpdate(){

        $input = $this->_input;

        $config_model = new Config();

        $dis = [

            'uniacid' => $this->_uniacid
        ];

        $data = $config_model->dataUpdate($dis,$input);

        return $this->success($data);

    }


}
